import request from '@/config/axios'

export interface DeviceMaintenanceTaskVO {
  id: number
  taskCode: string
  personInCharge: string
  deviceCode: string
  deviceName: string
  checkTime: Date
  templateName: string
  deviceType: string
  dictMaintenanceStatus: byte
}

// 查询生产管理-设备管理-设备点检/保养任务列表
export const getDeviceMaintenanceTaskPage = async (params) => {
  return await request.get({ url: `/produce/device-maintenance-task/page`, params })
}

// 查询生产管理-设备管理-设备点检/保养任务详情
export const getDeviceMaintenanceTask = async (id: number) => {
  return await request.get({ url: `/produce/device-maintenance-task/get?id=` + id })
}

// 新增生产管理-设备管理-设备点检/保养任务
export const createDeviceMaintenanceTask = async (data: DeviceMaintenanceTaskVO) => {
  return await request.post({ url: `/produce/device-maintenance-task/create`, data })
}

// 修改生产管理-设备管理-设备点检/保养任务
export const updateDeviceMaintenanceTask = async (data: DeviceMaintenanceTaskVO) => {
  return await request.put({ url: `/produce/device-maintenance-task/update`, data })
}

// 删除生产管理-设备管理-设备点检/保养任务
export const deleteDeviceMaintenanceTask = async (id: number) => {
  return await request.delete({ url: `/produce/device-maintenance-task/delete?id=` + id })
}

// 导出生产管理-设备管理-设备点检/保养任务 Excel
export const exportDeviceMaintenanceTask = async (data) => {
  return await request.download({ url: `/produce/device-maintenance-task/export-excel`, data })
}

//获取设备名称、编码
export const getDeviceMessageList = async (params) => {
  return await request.post({ url: `/config/device-archives/list-all-simple`,params})
}

// 获得生产管理-设备管理-设备点检-保养任务关系
export const getDeviceCheckTask = async (id:number) => {
  return await request.get({ url: `/produce/device-check-task/get?taskId=` + id})
}
